package com.example.consumer.config;

import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

/**
 * @Date: 2024/9/27
 * @Author: Administrator
 * @ClassName: RestTemplateConfig
 * @Description: 配置类，用它来替代浏览器实现给各项服务发送请求
 */

@Configuration
public class RestTemplateConfig {

    @Bean
    @LoadBalanced    // 开启负载均衡
    public RestTemplate restTemplate() {
        return new RestTemplate();
    }
}
